home *** CD-ROM | disk | FTP | other *** search
- /* math.h standard header */
- #ifdef __MWERKS__ /* __MWERKS__ */
-
- #ifdef powerc
- #ifndef __MATH__
- #define __MATH__
-
- #if __MWERKS__
- #pragma options align=mac68k
- #endif
-
- /* We need the pascal keyword for compiling fp.h */
- #pragma only_std_keywords off
- #include <fp.h>
-
- typedef union {
- unsigned short _W[5];
- float _F;
- double _D;
- long double _L;
- } _Dconst;
-
- float cosf(float);
- float sinf(float);
- float powf(float, float);
- float logf(float);
- float atan2f(float, float);
- float sqrtf(float);
- float ldexpf(float, int);
- float fabsf(float);
- float _FCosh(float, float);
- float _FSinh(float, float);
- float _FLog(float, int);
- float _FSin(float, unsigned int);
-
- #if __MWERKS__
- #pragma options align=reset
- #endif
-
- #endif /* __MATH__ */
- #endif /* powerc */
-
- #ifndef __MATH__
- #define __MATH__
-
- #if __MWERKS__
- #pragma options align=mac68k
- #endif
-
- /* We need the pascal keyword for compiling Types.h */
- #pragma only_std_keywords off
- #include <Types.h>
-
- #define _PI (*(long double *)__pi)
- #define HUGE_VAL (*(long double *)__minf__)
-
- extern short __minf__[],__pi[];
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- // Conversion routines for between 10byte and 12byte long doubles ...
- extern asm void __x96tox80(extended96 *,extended80 *);
- extern asm void __x80tox96(extended80 *,extended96 *);
-
-
- #if __MC68881__
-
- long double _sin(long double:__FP0):__FP0 = { 0xF200,0x000E };
- long double _cos(long double:__FP0):__FP0 = { 0xF200,0x001D };
- long double _tan(long double:__FP0):__FP0 = { 0xF200,0x000F };
- long double _asin(long double:__FP0):__FP0 = { 0xF200,0x000C };
- long double _acos(long double:__FP0):__FP0 = { 0xF200,0x001C };
- long double _atan(long double:__FP0):__FP0 = { 0xF200,0x000A };
- long double _sinh(long double:__FP0):__FP0 = { 0xF200,0x0002 };
- long double _cosh(long double:__FP0):__FP0 = { 0xF200,0x0019 };
- long double _tanh(long double:__FP0):__FP0 = { 0xF200,0x0009 };
- long double _exp(long double:__FP0):__FP0 = { 0xF200,0x0010 };
- long double _log(long double:__FP0):__FP0 = { 0xF200,0x0014 };
- long double _log10(long double:__FP0):__FP0 = { 0xF200,0x0015 };
- long double _sqrt(long double:__FP0):__FP0 = { 0xF200,0x0004 };
- long double _fabs(long double:__FP0):__FP0 = { 0xF200,0x0018 };
- long double _fmod(long double:__FP0,long double:__FP1):__FP0 = { 0xF200,0x0421 };
- long double _ldexp(long double:__FP0,int:__D0):__FP0 = { 0xF200,0x4026 };
-
- #ifndef __HYBRIDMATH__
-
- #define sin(x) _sin(x)
- #define cos(x) _cos(x)
- #define tan(x) _tan(x)
- #define asin(x) _asin(x)
- #define acos(x) _acos(x)
- #define atan(x) _atan(x)
- #define sinh(x) _sinh(x)
- #define cosh(x) _cosh(x)
- #define tanh(x) _tanh(x)
- #define exp(x) _exp(x)
- #define sqrt(x) _sqrt(x)
- #define fabs(x) _fabs(x)
- #define fmod(x,y) _fmod((x),(y))
- #define ldexp(x,n) _ldexp((x),(n))
-
- #ifdef __FASTMATH__
- #define log(x) _log(x)
- #define log10(x) _log10(x)
- #endif /* __FASTMATH__ */
-
- #endif /* __HYBRIDMATH */
-
- #endif /* __MC68881__ */
-
- double (sin)(double);
- double (cos)(double);
- double (tan)(double);
- double (asin)(double);
- double (acos)(double);
- double (atan)(double);
- double (atan2)(double,double);
- double (sinh)(double);
- double (cosh)(double);
- double (tanh)(double);
- double (exp)(double);
- double (log)(double);
- double (log10)(double);
- double (pow)(double,double);
- double (sqrt)(double);
- double (ceil)(double);
- double (floor)(double);
- double (fabs)(double);
- double (ldexp)(double,int);
- double (frexp)(double,int *);
- double (modf)(double,double *);
- double (fmod)(double,double);
-
-
- /* float declarations */
- float acosf(float);
- float asinf(float);
- float atanf(float);
- float atan2f(float, float);
- float cosf(float);
- float sinf(float);
- float ceilf(float);
- float expf(float);
- float fabsf(float);
- float floorf(float);
- float fmodf(float, float);
- float frexpf(float, int *);
- float ldexpf(float, int);
- float modff(float, float *);
- float powf(float, float);
- float sqrtf(float);
- float tanf(float);
- float tanhf(float);
- float _FCosh(float, float);
- float _FLog(float, int);
- float _FSin(float, unsigned int);
- float _FSinh(float, float);
- float coshf(float);
- float logf(float);
- float log10f(float);
- float sinhf(float);
-
- /*
- #define cosf(x) _FSin(x, 1)
- #define coshf(x) _FCosh(x, 1)
- #define logf(x) _FLog(x, 0)
- #define log10f(x) _FLog(x, 1)
- #define sinf(x) _FSin(x, 0)
- #define sinhf(x) _FSinh(x, 1)
- */
-
- typedef union {
- unsigned short _W[5];
- float _F;
- double _D;
- long double _L;
- } _Dconst;
-
-
- #ifdef __cplusplus
- }
- #endif
-
- #if __MWERKS__
- #pragma options align=reset
- #endif
-
- #endif /* __MATH__ */
-
- #else /* !__MWERKS__ */
-
- #ifndef _MATH
- #define _MATH
- #include <yvals.h>
- /* macros */
- #define HUGE_VAL _Hugeval._D
- /* type definitions */
- #if defined(__CENTERLINE__)
- typedef struct {
- #else
- typedef union {
- #endif
- unsigned short _W[5];
- float _F;
- double _D;
- long double _L;
- } _Dconst;
- _C_LIB_DECL
- /* double declarations */
- double acos(double);
- double asin(double);
- double atan(double);
- double atan2(double, double);
- double ceil(double);
- double exp(double);
- double fabs(double);
- double floor(double);
- double fmod(double, double);
- double frexp(double, int *);
- double ldexp(double, int);
- double modf(double, double *);
- double pow(double, double);
- double sqrt(double);
- double tan(double);
- double tanh(double);
- double _Cosh(double, double);
- double _Log(double, int);
- double _Sin(double, unsigned int);
- double _Sinh(double, double);
- extern const _Dconst _Hugeval;
- /* float declarations */
- float acosf(float);
- float asinf(float);
- float atanf(float);
- float atan2f(float, float);
- float ceilf(float);
- float expf(float);
- float fabsf(float);
- float floorf(float);
- float fmodf(float, float);
- float frexpf(float, int *);
- float ldexpf(float, int);
- float modff(float, float *);
- float powf(float, float);
- float sqrtf(float);
- float tanf(float);
- float tanhf(float);
- float _FCosh(float, float);
- float _FLog(float, int);
- float _FSin(float, unsigned int);
- float _FSinh(float, float);
- /* long double declarations */
- long double acosl(long double);
- long double asinl(long double);
- long double atanl(long double);
- long double atan2l(long double, long double);
- long double ceill(long double);
- long double expl(long double);
- long double fabsl(long double);
- long double floorl(long double);
- long double fmodl(long double, long double);
- long double frexpl(long double, int *);
- long double ldexpl(long double, int);
- long double modfl(long double, long double *);
- long double powl(long double, long double);
- long double sqrtl(long double);
- long double tanl(long double);
- long double tanhl(long double);
- long double _LCosh(long double, long double);
- long double _LLog(long double, int);
- long double _LSin(long double, unsigned int);
- long double _LSinh(long double, long double);
- _END_C_LIB_DECL
- #ifdef __cplusplus
- /* double inlines, for C++ */
- inline double cos(double _X)
- {return (_Sin(_X, 1)); }
- inline double cosh(double _X)
- {return (_Cosh(_X, 1)); }
- inline double log(double _X)
- {return (_Log(_X, 0)); }
- inline double log10(double _X)
- {return (_Log(_X, 1)); }
- inline double sin(double _X)
- {return (_Sin(_X, 0)); }
- inline double sinh(double _X)
- {return (_Sinh(_X, 1)); }
- /* float inlines, for C++ */
- inline float cosf(float _X)
- {return (_FSin(_X, 1)); }
- inline float coshf(float _X)
- {return (_FCosh(_X, 1)); }
- inline float logf(float _X)
- {return (_FLog(_X, 0)); }
- inline float log10f(float _X)
- {return (_FLog(_X, 1)); }
- inline float sinf(float _X)
- {return (_FSin(_X, 0)); }
- inline float sinhf(float _X)
- {return (_FSinh(_X, 1)); }
- /* long double inlines, for C++ */
- inline long double cosl(long double _X)
- {return (_LSin(_X, 1)); }
- inline long double coshl(long double _X)
- {return (_LCosh(_X, 1)); }
- inline long double logl(long double _X)
- {return (_LLog(_X, 0)); }
- inline long double log10l(long double _X)
- {return (_LLog(_X, 1)); }
- inline long double sinl(long double _X)
- {return (_LSin(_X, 0)); }
- inline long double sinhl(long double _X)
- {return (_LSinh(_X, 1)); }
- #else
- /* double macro overrides, for C */
- double cos(double);
- double cosh(double);
- double log(double);
- double log10(double);
- double sin(double);
- double sinh(double);
- #define cos(x) _Sin(x, 1)
- #define cosh(x) _Cosh(x, 1)
- #define log(x) _Log(x, 0)
- #define log10(x) _Log(x, 1)
- #define sin(x) _Sin(x, 0)
- #define sinh(x) _Sinh(x, 1)
- /* float macro overrides, for C */
- float cosf(float);
- float coshf(float);
- float logf(float);
- float log10f(float);
- float sinf(float);
- float sinhf(float);
- #define cosf(x) _FSin(x, 1)
- #define coshf(x) _FCosh(x, 1)
- #define logf(x) _FLog(x, 0)
- #define log10f(x) _FLog(x, 1)
- #define sinf(x) _FSin(x, 0)
- #define sinhf(x) _FSinh(x, 1)
- /* long double macro overrides, for C */
- long double cosl(long double);
- long double coshl(long double);
- long double logl(long double);
- long double log10l(long double);
- long double sinl(long double);
- long double sinhl(long double);
- #define cosl(x) _LSin(x, 1)
- #define coshl(x) _LCosh(x, 1)
- #define logl(x) _LLog(x, 0)
- #define log10l(x) _LLog(x, 1)
- #define sinl(x) _LSin(x, 0)
- #define sinhl(x) _LSinh(x, 1)
- #endif
-
- #endif
-
- #endif /* __MWERKS__ */
-
- /*
- * Copyright (c) 1994 by P.J. Plauger. ALL RIGHTS RESERVED.
- * Consult your license regarding permissions and restrictions.
- */
-
-